<?php
defined('IN_XLP') or exit('Access Denied');
$Document = array(
	'pageid'   => 'order-refund', //页面标示
	'pagename' => '处理退款订单', //当前页面名称
	'mycss'	   => array(), //加载的css样式表
	'myjs'	   => array(), //加载的js脚本
	'footerjs' => array(),
	'head'	   => true, //加载头部文件
);
include getTpl('header', 'public');
?>
<style>.pt7{padding-top:7px;}</style>
<form style="width:600px;height:400px;" class="form-horizontal" method="post" id="processForm">
	<div class="form-group">
		<label class="col-sm-2 control-label">买家</label>
		<div class="col-sm-5 pt7"><?php echo $order['recipients']; ?></div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">订单号</label>
		<div class="col-sm-5 pt7"><?php echo $order['order_sn']; ?></div>
	</div>
    <div class="form-group">
        <label class="col-sm-2 control-label">退款商品</label>
        <div class="col-sm-5 pt7">
        <?php foreach ($refund_goods as $k => $v): ?>
        <?php echo $v['goods_name'].' ('.$v['goods_num'].'件 金额：'.$v['goods_refund'].')<br>'; ?>
        <?php endforeach ?>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">退款金额</label>
        <div class="col-sm-5 pt7"><?php echo $order['refund_amount']; ?></div>
    </div>
	<div class="form-group">
		<label class="col-sm-2 control-label">申请时间</label>
		<div class="col-sm-5 pt7"><?php echo date('Y-m-d H:i:s', $order['refund_time']); ?></div>
	</div>
    <div class="form-group">
        <label class="col-sm-2 control-label">退款原因</label>
        <div class="col-sm-5 pt7"><?php echo $refund_reason; ?></div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">是否同意</label>
        <div class="col-sm-5">
            <div class="col-xs-1 radio" style="width:45%">
                <input id="agree" type="radio" name="agree" checked value="1">
                <label for="agree">同意</label>
            </div>
            <div class="col-xs-1 radio" style="width:45%">
                <input id="disagree" type="radio" name="agree" value="0">
                <label for="disagree">拒绝</label>
            </div>
        </div>
    </div>
	<div class="form-group">
		<label class="col-sm-2 control-label">备注</label>
		<div class="col-sm-5">
			<textarea name="note" id="note" cols="30" rows="10" data-required="true" class="bg-focus form-control" placeholder="同意OR拒绝原因"></textarea>
			<div class="line line-dashed m-t-large"></div>
		</div>
	</div>
	<div class="form-group">
		<div class="col-sm-9 col-lg-offset-2">
			<input type="hidden" name="order_id" value="<?php echo $order['id']; ?>">
			<div class="col-sm-1"><button type="submit" id="sub-ok" data-loading-text="正在提交..." class="btn btn-primary">保存</button></div>
			<button type="button" class="btn btn-white col-md-offset-2" onclick="self.location.reload();">取消</button>
		</div>
	</div>
</form>
<script>
$(function(){
	$('#processForm').submit(function(){
		var note = $.trim($('#note').val());
		if(note==''){
			Msg.error('请输入备注');
			resetSubmit("#sub-ok",'提交');
			return false;
		}
		Msg.loading();
		$.post('<?php echo U("order/refund_form");?>',$(this).serialize(),function(result){
			Msg.hide();
			resetSubmit("#sub-ok",'提交');
			if(result.status==1){
				Msg.ok(result.info);
				self.location.reload();
			}else{
				Msg.error(result.info);
			}
		},'JSON');
		return false;
	});
});
</script>
</body>
</html>